<template>
  <div>
    <button @click="isList = false">新增</button>
    <button @click="isList = true">列表</button>
    <br>
    <List v-if="isList" @isUpdate="childUpdate"/>
    <Create v-else/>
    <Update v-if="isUpdate" :item=this.item />
  </div>
</template>

<script>
import Create from "@/goods/Create.vue";
import List from "@/goods/List.vue";
import Update from "@/goods/Update.vue";

export default {
  name: "Layout",
  components: {List, Create, Update},
  data() {
    return {
      isUpdate: false,
      isList: true,
      item:{}
    }
  },
  methods:{
    childUpdate(data){
      console.log(data)
      this.isUpdate = true
      this.item = data
    },
  }
}
</script>

<style scoped>

</style>
